# $Id: PKGBUILD 65100 2012-02-20 03:39:28Z spupykin $
# Contributor: Jozef Riha <jose1711 at gmail dot com>

pkgname=cycle
pkgver=0.3.1
pkgrel=6
pkgdesc="Cycle is a calendar program for women"
url="http://cycle.sourceforge.net/"
license=('GPL2')
arch=('any')
depends=('python2' 'wxpython')
source=("http://prdownloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2"
        "cycle.desktop")
md5sums=('8bd5c2f78e7b1a7ac7910de8b9420d93'
         '2ce056808512dcdf55f0375b159ae6b1')

build() {
  cd ${srcdir}/${pkgname}-${pkgver}

  # python2 fix
  for file in cycle.py msg/{msgfmt.py,pygettext.py} setup.py; do
    sed -i 's_#!.*/usr/bin/env python_#!/usr/bin/env python2_' $file
  done

}
package() {
  cd ${srcdir}/${pkgname}-${pkgver}

  mkdir -p ${pkgdir}/usr/share/{cycle,man/man1}

  cp -pR * ${pkgdir}/usr/share/cycle
  mv cycle.1 ${pkgdir}/usr/share/man/man1

cat >./cycle <<EOF
#!/bin/bash
test -d ~/.cycle || mkdir ~/.cycle
cd /usr/share/cycle/
exec ./cycle.py
EOF
  install -D -m755 ./cycle ${pkgdir}/usr/bin/cycle
  install -D -m644 icons/cycle.xpm $pkgdir/usr/share/pixmaps/cycle.xpm
  install -D -m644 $srcdir/cycle.desktop $pkgdir/usr/share/applications/cycle.desktop
}
